﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using DocumentFormat.OpenXml.Spreadsheet;

namespace Exentials.Xoox.Spreadsheet
{
    public class XPageMargins : XElementBase, ISequence
    {
        private XAttributeBase<Unit> _left;
        private XAttributeBase<Unit> _right;
        private XAttributeBase<Unit> _top;
        private XAttributeBase<Unit> _bottom;
        private XAttributeBase<Unit> _header;
        private XAttributeBase<Unit> _footer;

        public XPageMargins()
            : base("pageMargins")
        {
            _left = new XAttributeBase<Unit>(this, "left", Unit.Define(0.7, UnitType.Inch));
            _right = new XAttributeBase<Unit>(this, "right", Unit.Define(0.7, UnitType.Inch));
            _top = new XAttributeBase<Unit>(this, "top", Unit.Define(0.7, UnitType.Inch));
            _bottom = new XAttributeBase<Unit>(this, "bottom", Unit.Define(0.7, UnitType.Inch));
            _header = new XAttributeBase<Unit>(this, "header", Unit.Define(0.3, UnitType.Inch));
            _footer = new XAttributeBase<Unit>(this, "footer", Unit.Define(0.3, UnitType.Inch));
        }

        public Unit Left
        {
            get { return _left.Value; }
            set { _left.Value = value; }
        }

        public Unit Right
        {
            get { return _right.Value; }
            set { _right.Value = value; }
        }

        public Unit Top
        {
            get { return _top.Value; }
            set { _top.Value = value; }
        }

        public Unit Bottom
        {
            get { return _bottom.Value; }
            set { _bottom.Value = value; }
        }

        public Unit Header
        {
            get { return _header.Value; }
            set { _header.Value = value; }
        }

        public Unit Footer
        {
            get { return _footer.Value; }
            set { _footer.Value = value; }
        }

        #region IIndex Members

        public int Index
        {
            get { return 21; }
        }

        #endregion
    }
}
